package com.acme.bankapp.domain.bank;

import com.acme.bankapp.domain.exceptions.NotEnoughFundsException;

public class SavingAccount extends AbstractAccount implements java.io.Serializable{

	public SavingAccount(final double amount) {
		super(amount);
	}
	
	public double getBalance() {
		return this.balance;
	}
 
	
	public void withdraw(double x) throws NotEnoughFundsException {
		if (this.balance >= x){
			this.balance -= x;
		} else {
			throw new NotEnoughFundsException();
		}
			
	}
	
	public void deposit(double x) {
		this.balance += x;
	}
	
	public double maximumAmountToWithdraw(){
		return this.balance; 
	}
	

	public String toString() {
		return "SavingAccount [balance=" + balance + ", decimalValue()="
				+ decimalValue() + ", hashCode()=" + hashCode() + "]";
	}

}
